<template>
  <div class="app-container">
   <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="基本信息" name="first">
        <div class="body-xx">
          <div class="container-xx">
            <div class="ceng2-xx">
              <div class="left-xx">公司名称：</div>
              <div class="right-xx">
                {{ deptName }}
              </div>
            </div>
            <div class="ceng2-xx">
              <div class="left-xx">个性签名：</div>
              <div class="right-xx">
                {{ personalSignature }}
              </div>
            </div>
            <ul class="ceng3-xx">
              <li>
                <div class="left-xx">所属行业：</div>
                <div class="right-xx">{{ industry }}</div>
              </li>
              <li>
                <div class="left-xx">企业性质：</div>
                <div class="right-xx">{{ nature }}</div>
              </li>
              <li>
                <div class="left-xx">注册资金：</div>
                <div class="right-xx">{{ registeredFund }}(万元)</div>
              </li>

              <li>
                <div class="left-xx">法人代表：</div>
                <div class="right-xx">{{ legalPerson }}</div>
              </li>
              <li>
                <div class="left-xx">统一社会信用代码：</div>
                <div class="right-xx">{{ creditCode }}</div>
              </li>
              <li>
                <div class="left-xx">成立时间：</div>
                <div class="right-xx">{{ foundTime }}</div>
              </li>
            </ul>
            <div class="ceng4">
              <div class="left-xx">企业地址：</div>
              <div class="right-xx">
                {{ address }}
              </div>
            </div>
            <div class="ceng4">
              <div class="left-xx">经营范围：</div>
              <div class="right-xx">
                {{ businessScope }}
              </div>
            </div>
            <div class="ceng4">
              <div class="left-xx">企业介绍：</div>
              <div class="right-xx">
                {{ companyProfile }}
              </div>
            </div>
            <div style="height: 50rem"></div>
          </div>
        </div>
      </el-tab-pane>
<!--      <el-tab-pane label="其他信息" name="second">-->
<!--         <div class="body-xx">-->
<!--          <div class="container-xx">-->
<!--            <ul class="tabs-xx">-->
<!--              <li-->
<!--                v-for="(item, index) in dict.type.other_type"-->
<!--                :class="index == 0 ? 'on' : ''"-->
<!--                @click="tabs3(index, $event)"-->
<!--                :key="index"-->
<!--              >-->
<!--                {{ item.label }}-->
<!--              </li>-->
<!--            </ul>-->
<!--            <div-->
<!--              class="tab-img-xx"-->
<!--              v-for="(item, index) in zmd3_xx"-->
<!--              :key="item.id"-->
<!--              v-if="zmd3_xx.length > 0"-->
<!--            >-->
<!--              <el-carousel :interval="4000" type="card" height="200px">-->
<!--                <el-carousel-item-->
<!--                  v-for="i in item.listitem.slice(0, 5)"-->
<!--                  :key="i.id"-->
<!--                >-->
<!--                  <div class="imgset-xx">-->
<!--                    <div class="box-xx">-->
<!--                      <img-->
<!--                        :src="i.url"-->
<!--                        alt=""-->
<!--                        @click="handlePictureCardPreview(i.url)"-->
<!--                      />-->
<!--                    </div>-->
<!--                    <span :title="i.infoName">{{-->
<!--                      i.infoName.length > 15-->
<!--                        ? i.infoName.substring(0, 15) + "..."-->
<!--                        : i.infoName-->
<!--                    }}</span>-->
<!--                  </div>-->
<!--                </el-carousel-item>-->
<!--              </el-carousel>-->
<!--            </div>-->
<!--            <div class="tab-img-xx" v-if="zmd3_xx.length == 0">-->
<!--              <el-empty :image-size="200"></el-empty>-->
<!--            </div>-->
<!--            <div style="height: 50rem"></div>-->
<!--          </div>-->
<!--        </div>-->
<!--      </el-tab-pane>-->
    </el-tabs>
    <el-dialog
      :title="deptLitle"
      :visible.sync="openAdmin"
      width="900"
      append-to-body
    >
      <el-form ref="form" :model="form" :rules="rulesAdmin" label-width="80px">
        <el-row>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="企业名称" prop="deptName" label-width="120px">
              <el-input
                v-model="form.deptName"
                placeholder="请输入企业名称"
                :disabled="disabledOne"
                :maxlength="20"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="企业性质" prop="nature" label-width="120px">
              <el-select
                style="width: 243px"
                v-model="form.nature"
                placeholder="请选择企业性质"
                :disabled="disabledTwo"
              >
                <el-option
                  v-for="dict in dict.type.enterprise_nature"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                  style="padding-left: 15px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="所属行业" prop="industry" label-width="120px">
              <el-select
                v-model="form.industry"
                placeholder="请选择所属行业"
                style="width: 243px"
                :disabled="disabledTwo"
              >
                <el-option
                  v-if="$store.state.user.info.companyType == '0'"
                  v-for="dict in dict.type.customer_industry"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                  style="padding-left: 15px"
                ></el-option>
                <el-option
                  v-if="$store.state.user.info.companyType == '1'"
                  v-for="dict in dict.type.customer_industry_serve"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                  style="padding-left: 15px"
                ></el-option>
                <el-option
                  v-if="$store.state.user.info.companyType == '2'"
                  v-for="dict in dict.type.customer_industry_garden"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                  style="padding-left: 15px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12" style="height: 55px">
            <el-form-item
              label="法人代表"
              prop="legalPerson"
              label-width="120px"
            >
              <el-input
                v-model="form.legalPerson"
                placeholder="请输入法人代表"
                :maxlength="20"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="height: 55px">
            <el-form-item
              label="注册资金"
              prop="registeredFund"
              label-width="120px"
            >
              <el-input
                style="width: 255rem"
                v-model="form.registeredFund"
                placeholder="请输注册资金"
                :maxlength="25"
                :disabled="disabledTwo"
                min="1"
              />&nbsp;(万元)
            </el-form-item>
          </el-col>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="成立时间" prop="foundTime" label-width="120px">
              <el-date-picker
                v-model="form.foundTime"
                type="date"
                value-format="yyyy-MM-dd"
                :picker-options="pickerStartOptions"
                placeholder="选择日期"
                style="width: 243px"
                :disabled="disabledTwo"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="联系人" prop="contacts" label-width="120px">
              <el-input
                v-model="form.contacts"
                placeholder="请输入联系人"
                maxlength="20"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12" style="height: 55px">
            <el-form-item label="联系电话" prop="phone" label-width="120px">
              <el-input
                v-model="form.phone"
                placeholder="请输入联系电话"
                maxlength="11"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="height: 55px">
          <el-col :span="12" style="height: 55px">
            <el-form-item
              label="统一社会信用代码"
              prop="creditCode"
              label-width="120px"
            >
              <el-input
                v-model="form.creditCode"
                placeholder="请输入统一社会信用代码"
                :disabled="disabledOne"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="行政区域" prop="area" label-width="120px">
              <Treeselect
                v-model="form.area"
                :disabled="disabledTwo"
                :options="options"
                :flat="true"
                :show-count="true"
                :normalizer="normalizer"
                placeholder="请选择行政区域"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row style="height: 75px">
          <el-col :span="24" style="height: 55px">
            <el-form-item label="企业地址" prop="address" label-width="120px">
              <el-input
                v-model="form.address"
                type="textarea"
                placeholder="请输入企业地址"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="height: 75px">
          <el-col :span="24" style="height: 55px">
            <el-form-item
              label="个性签名"
              prop="personalSignature"
              label-width="120px"
            >
              <el-input
                v-model="form.personalSignature"
                type="textarea"
                placeholder="请输入个性签名"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="height: 75px">
          <el-col :span="24" style="height: 55px">
            <el-form-item
              label="经营范围"
              prop="businessScope"
              label-width="120px"
            >
              <el-input
                v-model="form.businessScope"
                type="textarea"
                placeholder="请输入经营范围"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="height: 75px">
          <el-col :span="24" style="height: 55px">
            <el-form-item
              label="企业介绍"
              prop="companyProfile"
              label-width="120px"
            >
              <el-input
                v-model="form.companyProfile"
                type="textarea"
                placeholder="请输入企业介绍"
                :disabled="disabledTwo"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" style="height: 75px">
            <el-form-item
              label="营业执照"
              class="is-required"
              label-width="120px"
            >
              <file-view
                :type="fileType1"
                :businessId="businessId"
                businessCode="business_license"
                :key="refreshKey"
              ></file-view>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" style="height: 75px">
            <el-form-item
              label="企业logo"
              label-width="120px"
              class="is-required"
            >
              <file-view
                :type="fileType"
                :businessId="businessId"
                :businessCode="businessCode"
                :key="refreshKey"
              ></file-view>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" style="height: 75px">
            <el-form-item label="公司图片" label-width="120px">
              <file-view
                :type="fileType1"
                :businessId="businessId"
                businessCode="enterprisePictrue"
                :key="refreshKey"
              ></file-view>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" v-if="is_certified == '2'" @click="submitForm"
          >保 存</el-button
        >
        <el-button
          type="primary"
          v-if="is_certified == '0'"
          @click="submitFormTwo"
          >保 存</el-button
        >
        <el-button
          type="primary"
          v-if="is_certified == '3'"
          @click="submitFormOne"
          >保 存</el-button
        >
        <el-button @click="cancel">关 闭</el-button>
      </div>
    </el-dialog>
    <el-dialog
      title="其他信息"
      :visible.sync="openOther"
      width="800px"
      append-to-body
    >
      <el-row>
        <el-col>
          <el-form
            :model="queryOtherParams"
            ref="queryOtherForm"
            size="small"
            :inline="true"
            label-width="68px"
          >
            <el-form-item label="图片名称" prop="infoName">
              <el-input
                v-model="queryOtherParams.infoName"
                placeholder="请输入图片名称"
                clearable
                @keyup.enter.native="handleOtherQuery"
              />
            </el-form-item>
            <el-form-item label="图片类型" prop="infoType">
              <el-select
                v-model="queryOtherParams.infoType"
                placeholder="请输入合作类型"
              >
                <el-option
                  v-for="dict in dict.type.other_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                  style="padding-left: 15px"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button
                type="primary"
                icon="el-icon-search"
                size="mini"
                @click="handleOtherQuery"
                >搜索</el-button
              >
              <el-button
                icon="el-icon-refresh"
                size="mini"
                @click="resetOtherQuery"
                >重置</el-button
              >
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAddOther"
            >新增</el-button
          >
          <el-button style="padding: 7px 22px" @click="handleCancel"
            >关闭</el-button
          >
        </el-col>
      </el-row>
      <el-table
        v-loading="loading"
        :data="deptotherinfoList"
        style="margin-top: 8px"
        :row-style="{ height: ' 30px' }"
        border
        :cell-style="{ padding: '0px' }"
      >
        <el-table-column
          label="序号"
          type="index"
          align="center"
          prop="index"
          :index="indexMethod"
        />
        <el-table-column label="图片名称" align="center" prop="infoName" />
        <el-table-column
          label="图片类型"
          align="center"
          prop="infoType"
          width="140"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.other_type"
              :value="scope.row.infoType"
            />
          </template>
        </el-table-column>
        <el-table-column label="图片" align="center" prop="url" width="180">
          <template slot-scope="scope">
            <!-- <div v-if="scope.row.url != null && scope.row.url != '' && (scope.row.url).indexOf('.pdf')
                            !== -1
                            " @click="handlePictureCardPreviewPdf(scope.row.url)">
                            <pdf :src="scope.row.url"></pdf>
                        </div>
                        <div class="block" v-else>
                            <el-image style="width: 50px; height: 50px" :src="scope.row.url"
                                @click="handlePictureCardPreview(scope.row.url)">
                                <div slot="error" class="image-slot">
                                    <i class="el-icon-picture-outline"></i>
                                </div>
                            </el-image>
                        </div> -->
            <img
              v-if="scope.row.url"
              @click="handlePictureCardPreview(scope.row.url)"
              :src="scope.row.url"
              class="thumbnail-image"
              alt="附件图片"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          width="60"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              title="删除"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryOtherParams.pageNum"
        :limit.sync="queryOtherParams.pageSize"
        @pagination="getList"
      />
    </el-dialog>
    <el-dialog
      title="添加其他信息"
      :visible.sync="openOtherAdd"
      width="500px"
      append-to-body
    >
      <el-form
        ref="formOther"
        :model="formOther"
        :rules="rulesOther"
        label-width="80px"
      >
        <el-row style="height: 55px">
          <el-form-item label="图片名称" prop="infoName" label-width="80px">
            <el-input
              v-model="formOther.infoName"
              placeholder="请输入图片名称"
              :maxlength="50"
            />
          </el-form-item>
        </el-row>
        <el-row style="height: 55px">
          <el-form-item label="图片类型" prop="infoType" label-width="80px">
            <el-select
              v-model="formOther.infoType"
              placeholder="请选择图片类型"
              style="width: 380px"
            >
              <el-option
                v-for="dict in dict.type.other_type"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
                style="padding-left: 15px"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-row>
        <el-row style="height: 55px">
          <el-form-item label="图片" class="is-required" label-width="80px">
            <file-view
              :type="fileTypeOther"
              :businessId="businessIdOther"
              businessCode="otherUpload"
              :key="refreshKey"
              @change="getFile"
            ></file-view>
          </el-form-item>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormOther">确 定</el-button>
        <el-button @click="cancelOther">关 闭</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisible" append-to-body>
      <img width="100%" :src="dialogImageUrl" alt="" />
    </el-dialog>
    <el-dialog :visible.sync="dialogVisiblePdf" append-to-body>
      <pdf
        v-for="item in pageTotal"
        :src="pdfUrl"
        :key="item"
        :page="item"
      ></pdf>
    </el-dialog>
  </div>
</template>

<script>
import {
  listDept,
  getDept,
  delDept,
  addDept,
  updateDept,
  listDeptExcludeChild,
} from "@/api/system/dept";
import { listData } from "@/api/system/dict/data";
import FileView from "@/components/FileView/index";
import { listManagementType } from "@/api/collaborative/management";
import pdf from "vue-pdf";
import { queryFile, fileRemove } from "@/api/system/file";
import { listHonorManagementType } from "@/api/honor/management";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { listArea } from "@/api/area/area";
import {
  listDeptotherinfo,
  getDeptotherinfo,
  delDeptotherinfo,
  addDeptotherinfo,
  updateDeptotherinfo,
  listDeptotherinfoType,
} from "@/api/otherInfo/other";
export default {
  name: "Info",
  dicts: [
    "customer_industry_serve",
    "customer_industry_garden",
    "enterprise_nature",
    "customer_industry",
    "certificate_type",
    "other_type",
    "sys_org_type",
    "other_type",
  ],
  components: { FileView, pdf, Treeselect },
  data() {
      return {
        activeName: 'first',
      newId: "",
      tempList: [],
      deptLitle: "",
      disabledOne: false,
      disabledTwo: false,
      is_certified: "",
      total: 0,
      showSearch: true,
      businessIdOther: null,
      index: null,
      openOther: false,
      openOtherAdd: false,
      formOther: {},
      queryOtherParams: {
        pageNum: 1,
        pageSize: 5,
        deptId: null,
        infoName: null,
        infoType: null,
        createId: null,
        createName: null,
        operateId: null,
        operateName: null,
        operateTime: null,
        belongTo: null,
      },
      queryParams: {
        deptId: null,
        infoName: null,
        infoType: null,
        createId: null,
        createName: null,
        operateId: null,
        operateName: null,
        operateTime: null,
        belongTo: null,
      },
      queryParamsType: {
        organizationId: null,
        companyType: null,
      },
      queryParamsHonor: {
        name: null,
        type: "",
        customerId: null,
        level: null,
        status: null,
        classificationId: null,
        organizationId: null,
        enterpriseName: null,
      },
      form: {},
      rulesAdmin: {
        legalPerson: [
          { required: true, message: "法人代表不能为空", trigger: "blur" },
        ],
        creditCode: [
          {
            required: true,
            message: "统一社会信用代码不能为空",
            trigger: "blur",
          },
          {
            max: 50,
            message: "统一社会信用代码长度不能超过100",
            trigger: "blur",
          },
        ],
        deptName: [
          { required: true, message: "企业名称不能为空", trigger: "blur" },
        ],
      },
      rulesOther: {
        infoName: [
          { required: true, message: "图片名称不能为空", trigger: "blur" },
        ],
        infoType: [
          { required: true, message: "图片类型不能为空", trigger: "change" },
        ],
      },
      openAdmin: false,
      businessId: null,
      businessCode: "enterprise_logo",
      fileType: 0,
      fileType1: 0,
      fileTypeOther: 0,
      refreshKey: 0,
      industryList: [],
      options: null,
      deptName: null,
      companyProfile: null,
      registeredFund: null,
      legalPerson: null,
      nature: null,
      creditCode: null,
      foundTime: null,
      businessScope: null,
      industry: null,
      address: null,
      personalSignature: null,
      pickerStartOptions: {
        disabledDate: time => {
          return time.getTime() > Date.now() - 8.64e7;
        },
      },
      disabled: false,
      logoUrl: null,
      deptotherinfoList: [],
      isShow: 0,
      isShow2: 0,
      isShow3: 0,
      pageTotal: null,
      dialogImageUrl: "",
      dialogImageUrlPdf: "",
      dialogVisible: false,
      dialogVisiblePdf: false,
      zmd1_xx: [],
      zmd2_xx: [],
      zmd3_xx: [],
    };
  },
  created() {
    this.newId = this.$route.params.enterpriseId;
    this.getDeptInfo();
    this.getList();
    this.getOtherList();
    this.getHonorList();
    this.getCollaborative();
    this.area();
  },
  methods: {
    area() {
      listArea({}).then(response => {
        this.options = response.data;
      });
    },
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.areaId,
        label: node.areaName,
        isDisabled: false,
        children: node.list.length > 0 ? node.list : 0,
      };
    },
    getFile(event) {},
    handleOtherQuery() {
      this.queryOtherParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetOtherQuery() {
      this.resetForm("queryOtherForm");
      this.handleOtherQuery();
    },
    cancelOther() {
      this.openOtherAdd = false;
    },
    getList() {
      this.loading = true;
      this.queryOtherParams.deptId = this.newId;
      listDeptotherinfo(this.queryOtherParams).then(response => {
        this.deptotherinfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getOtherList() {
      this.zmd3_xx = [];
      this.queryParams.deptId = this.newId;
      this.queryParams.infoType = "0";
      listDeptotherinfoType(this.queryParams).then(response => {
        if (response[0].listitem.length > 0) {
          this.zmd3_xx.push(response[0]);
        }
      });
    },
    getHonorList() {
      this.zmd1_xx = [];
      this.queryParamsHonor.organizationId = this.newId;
      this.queryParamsHonor.type = "0";
      this.queryParamsHonor.status = "0";
      listHonorManagementType(this.queryParamsHonor).then(response => {
        if (response[0].listitem.length > 0) {
          this.zmd1_xx.push(response[0]);
        }
      });
    },
    getCollaborative() {
      this.zmd2_xx = [];
      this.queryParamsType.organizationId = this.newId;
      this.queryParamsType.companyType = "0";
      listManagementType(this.queryParamsType).then(response => {
        if (response[0].listitem.length > 0) {
          this.zmd2_xx.push(response[0]);
        }
      });
    },
    handlePictureCardPreview(url) {
      this.dialogImageUrl = url;
      this.dialogVisible = true;
    },
    handlePictureCardPreviewPdf(url) {
      this.pdfUrl = pdf.createLoadingTask(url);
      // 获取页码
      this.pdfUrl.promise
        .then(pdf => (this.pageTotal = pdf.numPages))
        .catch(error => {});
      this.dialogImageUrlPdf = url;
      this.dialogVisiblePdf = true;
    },
    indexMethod(index) {
      return (
        (this.queryOtherParams.pageNum - 1) * this.queryOtherParams.pageSize +
        index +
        1
      );
    },
    handleAddOther() {
      this.resetOther();
      this.formOther.deptId = this.newId;
      this.formOther.id = this.guid();
      this.businessIdOther = this.formOther.id;
      this.fileTypeOther = 0;
      this.refreshKey++;
      this.openOtherAdd = true;
    },
    handleTest() {
      this.resetOtherQuery();
      this.openOther = true;
    },
    handleUpdate() {
      this.reset();
      const deptId = this.newId;
      this.businessId = deptId;
      this.fileType = 1;
      this.fileType1 = 1;
      this.refreshKey++;
      getDept(deptId).then(response => {
        this.form = response.data;
        this.deptType = response.data.type;
        if (response.data.isCertified == "0") {
          this.deptLitle = "修改基本信息";
          this.fileType = 1;
          this.fileType1 = 1;
          this.disabledOne = false;
          this.disabledTwo = false;
        }
        if (response.data.isCertified == "1") {
          this.fileType = 2;
          this.fileType1 = 2;
          this.disabledOne = true;
          this.disabledTwo = true;
          this.deptLitle = "查看基本信息";
        }
        if (response.data.isCertified == "2") {
          this.fileType = 1;
          this.fileType1 = 1;
          this.disabledOne = true;
          this.disabledTwo = false;
          this.deptLitle = "修改基本信息";
        }
        if (response.data.isCertified == "3") {
          this.fileType = 1;
          this.fileType1 = 1;
          this.disabledOne = false;
          this.disabledTwo = false;
          this.deptLitle = "修改基本信息";
        }
      });
      this.openAdmin = true;
    },
    getDeptInfo() {
      const deptId = this.newId;
      getDept(deptId).then(response => {
        (this.deptName = response.data.deptName),
          (this.companyProfile = response.data.companyProfile);
        this.registeredFund = response.data.registeredFund;
        this.legalPerson = response.data.legalPerson;
        this.creditCode = response.data.creditCode;
        this.foundTime = response.data.foundTime;
        this.is_certified = response.data.isCertified;
        if (response.data.foundTime == null || response.data.foundTime == "") {
          this.foundTime = response.data.foundTime;
        } else {
          this.foundTime = response.data.foundTime.substring(0, 10);
        }
        this.businessScope = response.data.businessScope;
        this.address = response.data.address;
        this.personalSignature = response.data.personalSignature;
        if (response.data.industry == null || response.data.industry == "") {
          this.industry = "";
        } else {
          if (response.data.companyType == "0") {
            const paramsIndustry = {
              dictValue: response.data.industry,
              deptIds: [0],
              dictType: "customer_industry",
            };
            listData(paramsIndustry).then(response => {
              var industryList = response.rows;
              this.industry = industryList[0].dictLabel;
            });
          }
          if (response.data.companyType == "1") {
            const paramsIndustry = {
              dictValue: response.data.industry,
              deptIds: [0],
              dictType: "customer_industry_serve",
            };
            listData(paramsIndustry).then(response => {
              var industryList = response.rows;
              this.industry = industryList[0].dictLabel;
            });
          }
          if (response.data.companyType == "2") {
            const paramsIndustry = {
              dictValue: response.data.industry,
              deptIds: [0],
              dictType: "customer_industry_garden",
            };
            listData(paramsIndustry).then(response => {
              var industryList = response.rows;
              this.industry = industryList[0].dictLabel;
            });
          }
        }
        if (response.data.nature == null || response.data.nature == "") {
          this.nature = "";
        } else {
          const paramsNature = {
            dictValue: response.data.nature,
            deptIds: [0],
            dictType: "enterprise_nature",
          };
          listData(paramsNature).then(response => {
            var natureList = response.rows;
            this.nature = natureList[0].dictLabel;
          });
        }
        if (response.data.url == null || response.data.url == "") {
          this.logoUrl = require("../../assets/images/logo.png");
        } else {
          this.logoUrl = response.data.url;
        }
      });
    },
    // 表单重置
    reset() {
      this.form = {
        deptId: null,
        parentId: null,
        ancestors: null,
        deptName: null,
        type: "1",
        companyOrigin: null,
        abbreviate: null,
        registeredFund: null,
        legalPerson: null,
        companyType: "0",
        nature: null,
        creditCode: null,
        area: null,
        foundTime: null,
        businessScope: null,
        industry: null,
        contacts: null,
        address: null,
        orderNum: null,
        personalSignature: null,
        leader: null,
        phone: null,
        email: null,
        status: "0",
        fileId: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isCertified: null,
        reviewComments: null,
      };
      this.resetForm("form");
    },
    // 取消按钮
    cancel() {
      this.reset();
      this.openAdmin = false;
    },
    handleCancel() {
      this.openOther = false;
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          var businessId = this.newId;
          var businessCode = "enterprise_logo";
          var businessCode1 = "enterprisePictrue";
          var businessCode2 = "business_license";
          queryFile(businessId, businessCode2).then(response => {
            var dataFile = response.data;
            if (dataFile.length == 0) {
              this.$modal.msgError("请上传营业执照！");
            } else {
              queryFile(businessId, businessCode).then(response => {
                var dataFile = response.data;
                if (dataFile.length == 0) {
                  this.$modal.msgError("请上传企业logo！");
                } else {
                  updateDept(this.form).then(response => {
                    this.$modal.msgSuccess("修改成功");
                    this.openAdmin = false;
                    this.getDeptInfo();
                    this.refreshKey++;
                  });
                }
              });
            }
          });
        }
      });
    },
    submitFormTwo() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          var businessId = this.newId;
          var businessCode = "enterprise_logo";
          var businessCode1 = "enterprisePictrue";
          var businessCode2 = "business_license";
          queryFile(businessId, businessCode2).then(response => {
            var dataFile = response.data;
            if (dataFile.length == 0) {
              this.$modal.msgError("请上传营业执照！");
            } else {
              queryFile(businessId, businessCode).then(response => {
                var dataFile = response.data;
                if (dataFile.length == 0) {
                  this.$modal.msgError("请上传企业logo！");
                } else {
                  this.$confirm(
                    "保存数据后，将会提交认证申请到平台，企业部分重要信息不能再修改，是否继续？",
                    "提示",
                    {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      type: "warning",
                    }
                  ).then(() => {
                    this.form.isCertified = "1";
                    updateDept(this.form)
                      .then(response => {
                        this.openAdmin = false;
                        this.$alert("认证成功，等待系统管理员审核！", "消息", {
                          confirmButtonText: "确定",
                          callback: action => {
                            window.location.reload();
                            this.getDeptInfo();
                            this.refreshKey++;
                          },
                        });
                      })
                      .catch(() => {
                        this.$message({
                          type: "info",
                          message: "已取消保存",
                        });
                      });
                  });
                }
              });
            }
          });
        }
      });
    },
    submitFormOne() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          var businessId = this.newId;
          var businessCode = "enterprise_logo";
          var businessCode1 = "enterprisePictrue";
          var businessCode2 = "business_license";
          queryFile(businessId, businessCode2).then(response => {
            var dataFile = response.data;
            if (dataFile.length == 0) {
              this.$modal.msgError("请上传营业执照！");
            } else {
              queryFile(businessId, businessCode).then(response => {
                var dataFile = response.data;
                if (dataFile.length == 0) {
                  this.$modal.msgError("请上传企业logo！");
                } else {
                  this.$confirm(
                    "保存提交后不能再修改企业部分重要信息，是否继续？",
                    "提示",
                    {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      type: "warning",
                    }
                  ).then(() => {
                    this.form.isCertified = "1";
                    updateDept(this.form)
                      .then(response => {
                        this.openAdmin = false;
                        this.$alert("认证成功，等待系统管理员审核！", "消息", {
                          confirmButtonText: "确定",
                          callback: action => {
                            window.location.reload();
                            this.getDeptInfo();
                            this.refreshKey++;
                          },
                        });
                      })
                      .catch(() => {
                        this.$message({
                          type: "info",
                          message: "已取消保存",
                        });
                      });
                  });
                }
              });
            }
          });
        }
      });
    },
    submitFormOther() {
      this.$refs["formOther"].validate(valid => {
        if (valid) {
          var businessId = this.formOther.id;
          var businessCode = "otherUpload";
          queryFile(businessId, businessCode).then(response => {
            var dataFile = response.data;
            if (dataFile.length == 0) {
              this.$modal.msgError("请上传图片！");
            } else {
              addDeptotherinfo(this.formOther).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.openOtherAdd = false;
                this.getList();
                this.getOtherList();
                var linodes = this.tempList.target.parentNode.childNodes;
                for (let i = 0; i < linodes.length; i++) {
                  linodes[i].classList.remove("on");
                }
                linodes[0].className = "on";
              });
            }
          });
        }
      });
    },
    resetOther() {
      this.formOther = {
        id: null,
        deptId: null,
        infoName: null,
        infoType: null,
        createId: null,
        createName: null,
        createTime: null,
        operateId: null,
        operateName: null,
        operateTime: null,
        belongTo: null,
      };
      this.resetForm("formOther");
    },
    guid() {
      function S4() {
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
      }
      return (
        S4() +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        "-" +
        S4() +
        S4() +
        S4()
      );
    },
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除图片名称为"' + row.infoName + '"的数据项？')
        .then(function () {
          return delDeptotherinfo(ids);
        })
        .then(() => {
          this.getList();
          this.getOtherList();
          var linodes = this.tempList.target.parentNode.childNodes;
          for (let i = 0; i < linodes.length; i++) {
            linodes[i].classList.remove("on");
          }
          linodes[0].className = "on";
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    tabs1(index, e) {
      this.isShow = index;
      this.queryParamsHonor.organizationId = this.newId;
      this.queryParamsHonor.type = index;
      this.queryParamsHonor.status = "0";
      listHonorManagementType(this.queryParamsHonor).then(response => {
        this.zmd1_xx = [];
        if (response[0].listitem.length > 0) {
          this.zmd1_xx.push(response[0]);
        }
      });
      var linodes = e.target.parentNode.childNodes;
      for (let i = 0; i < linodes.length; i++) {
        linodes[i].classList.remove("on");
      }
      e.target.className = "on";
    },
    tabs2(index, e) {
      this.isShow2 = index;
      this.queryParamsType.organizationId = this.newId;
      this.queryParamsType.companyType = index;
      listManagementType(this.queryParamsType).then(response => {
        this.zmd2_xx = [];
        if (response[0].listitem.length > 0) {
          this.zmd2_xx.push(response[0]);
        }
      });
      var linodes = e.target.parentNode.childNodes;
      for (let i = 0; i < linodes.length; i++) {
        linodes[i].classList.remove("on");
      }
      e.target.className = "on";
    },
    tabs3(index, e) {
      this.isShow3 = index;
      this.queryParams.deptId = this.newId;
      this.queryParams.infoType = index;
      this.tempList = e;
      listDeptotherinfoType(this.queryParams).then(response => {
        this.zmd3_xx = [];
        if (response[0].listitem.length > 0) {
          this.zmd3_xx.push(response[0]);
        }
      });
      var linodes = e.target.parentNode.childNodes;
      for (let i = 0; i < linodes.length; i++) {
        linodes[i].classList.remove("on");
      }
      e.target.className = "on";
    },
  },
};
</script>

<style scoped>
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 100%;
  font-weight: normal;
}

.body-xx {
  width: 100%;
  height: 100%;
  margin-top: 20rem;
  font-size: 20rem;
  font-family: Microsoft YaHei, PingFang SC, Arial, sans-serif;
  color: #676767;
}

.container-xx {
  width: 95%;
  height: 100%;
  margin: auto;
}

.ceng1-xx {
  width: 100%;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20rem;
}

.ceng1-xx > .left-xx > img {
  max-width: 300rem;
  max-height: 150rem;
  margin-top: 37rem;
}

.ceng2-xx {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  margin-bottom: 15rem;
}

.ceng2-xx > .left-xx {
  white-space: nowrap;
  color: #333;
}

.ceng2-xx > .right-xx {
  width: 94%;
  font-size: 14px;
  word-wrap: break-word;
  line-height: 30rem;
  color: black;
}

.ceng3-xx {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 15rem;
}

.ceng3-xx > li {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  line-height: 42rem;
  align-items: center;
  width: 33.33%;
}

.ceng3-xx > li:nth-child(3n + 2) {
  width: 40%;
}

.ceng3-xx > li:nth-child(3n + 3) {
  width: 26.67%;
}

.ceng3-xx > li > .left-xx {
  white-space: nowrap;
  color: #333;
}

.ceng3-xx > li > .right-xx {
  line-height: 30rem;
  font-size: 14px;
  color: black;
}

.ceng4 {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  margin-bottom: 15rem;
}

.ceng4 > .left-xx {
  white-space: nowrap;
  color: #333;
}

.ceng4 > .right-xx {
  width: 94%;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 30rem;
  color: black;
}

.title-xx {
  width: 100%;
  font-size: 25rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  justify-content: space-between;
  color: #333;
  margin-top: 15rem;
}

.title-xx > .left-xx {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.title-xx > .left-xx > i {
  width: 5rem;
  height: 32rem;
  background-color: #338be1;
  display: inline-block;
  margin-right: 6rem;
}

.title-xx > button {
  width: 37rem;
  height: 36rem;
  background-size: 100% 100%;
  border: none;
  position: relative;
  left: 1511rem;
  cursor: pointer;
}

.tab-img-xx {
  width: 100%;
  height: 320rem;
}

::v-deep .tab-img-xx .el-carousel__container {
  height: 335rem !important;
}

.imgset-xx {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.imgset-xx > .box-xx {
  width: 380rem;
  height: 304rem;
  background-color: #eee;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: center;
}

.imgset-xx > .box-xx > img {
  max-width: 380rem;
  max-height: 304rem;
}

.imgset-xx > span {
  font-size: 20rem;
  padding-top: 4rem;
}

.tabs-xx {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 38rem;
  width: 100%;
  background-color: #f1f2f3;
  border-top: 2rem solid #e0dfe0;
  margin-bottom: 0rem;
}

.tabs-xx > li {
  margin-left: 38rem;
  margin-right: 38rem;
  cursor: pointer;
}

.tabs-xx > li.on {
  color: #338be1;
}

.tab2-img-xx {
  width: 100%;
  max-height: 620rem;
  overflow-y: auto;
  padding-left: 50rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  /* justify-content: center; */
}

.tab2-img-xx::-webkit-scrollbar {
  width: 4px;
  /*height: 4px;*/
}

.tab2-img-xx::-webkit-scrollbar-thumb {
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.1);
}

.tab2-img-xx::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.03);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.03);
}

.tab2-img-xx .box2-xx {
  width: 210rem;
  height: 180rem;
  background-color: white;
  margin: 15rem 15rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab2-img-xx img {
  max-width: 210rem;
  max-height: 191rem;
}

::v-deep .tab2-img-xx .el-carousel__container {
  height: 94% !important;
}

::v-deep .tab2-img-xx .el-carousel__arrow--left {
  left: -70rem;
}

::v-deep .tab2-img-xx .el-carousel__arrow--right {
  right: 22rem;
}

::v-deep .tab2-img-xx .el-carousel__item {
  background-color: white;
}

::v-deep .tab2-img-xx .el-carousel__indicators--outside {
  padding-right: 80rem;
}

.tab2-img-xx .el-carousel {
  height: 100%;
  padding-left: 120rem;
}

.pagination-container {
  margin-top: 15rem;
}

::v-deep .tab-img-xx .el-carousel__item.is-active {
  transform: translateX(50%) scale(0.83) !important;
}

.thumbnail-image {
  width: 40rem;
  /* 根据需求调整宽度 */
  height: 30rem;
  margin-top: 8rem;
  border: 1px solid #ccc;
  /* 可选，添加边框样式 */
}
</style>
